<template>
  <el-dialog title="编辑章节" :visible.sync="isShow" @close="close">
    <el-form :model="model" :rules="rules">
      <el-form-item label="章节名称：" :label-width="'100px'">
        <el-input v-model="model.chapterTitle" autocomplete="on" placeholder="请输入章节名称"></el-input>
      </el-form-item>
      <el-form-item label="章节描述：" :label-width="'100px'">
        <el-input v-model="model.chapterMemo" autocomplete="off" placeholder="请输入内容" type="textarea"></el-input>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="close">{{$t('action.cancel')}}</el-button>
      <el-button type="primary" @click="close(model)">{{$t('action.comfirm')}}</el-button>
    </div>
  </el-dialog>
</template>

<script>
  export default {
    name: "AddChapter",
    props: {
      "model": {type:Object,default:{
          chapterTitle: '',
          chapterMemo: '',
        }},
    },
    data() {
      return {
        isShow:true,
        rules: {
          chapterTitle: [
            {required: true, message: '请输入章节名称', trigger: 'blur'},
          ],
          chapterMemo: [
            {required: true, message: '请输入内容', trigger: 'blur'},
          ],
        },
      }
    },
    methods:{
      close(data){
        this.$emit("closePop",data)
      }
    },
  }
</script>

<style scoped>

</style>
